//登录相关的‘操作’在这里
import { Injectable } from '@angular/core';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
import axios from 'axios';
//url config here
import { ConfigService } from './config.service';
@Injectable()
export class LoginService {
	constructor(private configService: ConfigService){
    }
    //accesstoken接口
    getLogin(){
        var self = this;
        return axios({
            method:'post',
            url:self.configService.getAccessTokenUrl(),
            data:{},
            headers: {
                "accept": "application/json",
				"content-type": "text/plain",
            }
        });
    }
    //登录 -- 获取号码接口
    getPhoneNum(msg){
        var self = this;
        return axios({
            method:'post',
            url:self.configService.getPhoneUrl(),
            data:{ 
                "msgId":msg
            },
            headers: {
                "accept": "application/json",
				"content-type": "text/plain",
            }
        });
    }

    //检查sms接口
    getCheck(tel,sms){
        var self = this;
        return axios({
            method:'post',
            url:self.configService.getCheckSmsUrl(),
            data:{
                "phone":tel,
                "smscode":sms
            }
        });
    }
    //获取sms code
    getSmsCode(tel){
        var self = this;
        return axios({
            method:'post',
            url:self.configService.getSendSmsUrl(),
            data:{
                "phone":tel
            }

        });
    }

    get11(tel){
        var self = this;
        return axios({
            method:'post',
            url:self.configService.get11Url(),
            data:{
                "phone":tel
            }
        });
    }
    getUser(tel){
        var self = this;
        return axios({
            method:'post',
            url:self.configService.getUserUrl(),
            data:{
                "phone":tel
            }
        });
    }

}